<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Simple else if example</title>
</head>
<body>
    <label for="weather">Select the weather type tody：</label>
    <select name="" id="weather">
        <option value="">--Make a Chioci</option>
        <option value="sunny">Sunny</option>
        <option value="rainy">Rainy</option>
        <option value="snowing">Snowing</option>
        <option value="overcast">Overcast</option>
    </select>
    <p></p>
    <script>
        var select = document.querySelector('select');
        var para = document.querySelector('p');

        select.addEventListener('change', setWeather);

        function setWeather(){
            var choice = select.value;
            if(choice === 'sunny') {
                para.textContent = 'It is nice and sunny outside today. Wear shorts! Go to the beach, or the park, and get an ice cream.';
            } else if (choice === 'rainy') {
                para.textContent = 'Rain is falling outside; take a rain coat and a brolly, and don\'t stay out for too long.';
            } else if (choice === 'snowing') {
                para.textContent = 'The snow is coming down — it is freezing! Best to stay in with a cup of hot chocolate, or go build a snowman.';
            } else if (choice === 'overcast') {
                para.textContent = 'It isn\'t raining, but the sky is grey and gloomy; it could turn any minute, so take a rain coat just in case.';
            } else {
                para.textContent = '';
            }
        }
    </script>
</body>
</html>